#ifndef RK3588_RETINAFACE_CUSTOM_H
#define RK3588_RETINAFACE_CUSTOM_H

#include "engine/engine.h"
#include <memory>
#include <opencv2/opencv.hpp>
#include "process/postprocess.h"
#include "process/preprocess.h"


class RetinafaceCustom
{
public:
    RetinafaceCustom();
    ~RetinafaceCustom();

    nn_error_e LoadModel(const char *model_path);
    nn_error_e Run(const cv::Mat &img, retinaface_result *result);
    nn_error_e FaceAlignment(const cv::Mat &img, cv::Mat &align_img, retinaface_object_t *result);

private:
    nn_error_e Preprocess(const cv::Mat &img, cv::Mat &image_letterbox);
    nn_error_e Inference();
    nn_error_e Postprocess(const cv::Mat &img, retinaface_result *resultt);

    int img_height, img_width;  //图像的尺寸
    bool ready_;
    letterbox_t letter_box;
    tensor_data_s input_tensor_;
    std::vector<tensor_data_s> output_tensors_;
    bool want_float_;
    std::vector<int32_t> out_zps_;
    std::vector<float> out_scales_;
    std::shared_ptr<NNEngine> engine_;
};

#endif